<template>
  <div class="search">
    <el-form
      :model="listQueryIn"
      ref="queryForm"
      size="small"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="课程名称">
        <el-input
          placeholder="请输入课程名称"
          size="small"
          v-model="listQueryIn.title"
          clearable
        >
        </el-input>
      </el-form-item>
      <el-form-item label="发布状态">
        <el-select
          v-model="listQueryIn.status"
          clearable
          placeholder="发布状态"
          size="small"
        >
          <el-option label="暂存" value="0"> </el-option>
          <el-option label="待发布" value="2"> </el-option>
          <el-option label="已上线" value="1"> </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="">
        <el-button type="custom" size="small" @click="refreshList()" plain
          >搜索</el-button
        >
        <el-button   type="custom" size="small" @click="handleAdd()"
          >新增</el-button
        >
      </el-form-item>
    </el-form>
 
  </div>
</template>
<script>
import Bus from '@/utils/bus.js'
export default {
  data() {
    return {
      type: this.$route.meta.type,
      listQueryIn: {
        title: '',
        page: 1,
        status: '',
      },
      selectData: [],
    }
  },
  watch: {
    sourceType(v) {
      this.listQueryIn.code = ''
      this.listQueryIn.title = ''
      this.titleShow()
    },
    $route() {
      this.titleShow()
    },
  },
  props: ['sourceType'],
  mounted() {
    this.titleShow()
    this.$bus.$on('sendSelectData', (v) => {
      this.selectData = v
    })
  },
  beforeDestroy() {
    this.$bus.$off('sendSelectData')
  },
  methods: {
    titleShow() {
      this.type = this.$route.meta.type
    },
    refreshList() {
      Bus.$emit('refreshCourseList', this.listQueryIn)
    },
    handleAdd() {
      Bus.$emit('showDialogCourseAdd')
    },
    
   
  },
}
</script>